package com.xq.action;

import com.xq.pojo.People;
import com.xq.service.PeopleService;
import lombok.Setter;

import java.util.List;

/**
 * @author xq
 * @version 1.0
 * @date 2021/4/6 22:30
 * @description 人们控制器层
 */
@Setter
public class PeopleAction {
    private PeopleService peopleService;

    /**
     * 新增人们数据
     * @param p 人们对象
     * @return 返回添加状态
     */
    public Integer addPeople(People p){
        return this.peopleService.addPeople(p);
    }

    /**
     * 新增人们数据，选择性的添加属性值
     * @param p 人们对象
     * @return 返回添加状态
     */
    public Integer addPeopleSelective(People p) {
        return this.peopleService.addPeopleSelective(p);
    }

    /**
     * 修改人们数据，可以选择性修改属性值
     * @param p 人们对象
     * @return 返回修改状态
     */
    public Integer updatePeopleByIdSelective(People p){
        return this.peopleService.updatePeopleByIdSelective(p);
    }

    /**
     * 修改人们数据
     * @param p 人们对象
     * @return 返回修改状态
     */
    public Integer updatePeopleById(People p){
        return this.peopleService.updatePeopleById(p);
    }

    /**
     * 根据id删除人们信息
     * @param id 人们id
     * @return 返回删除状态
     */
    public Integer deletePeopleById(Integer id) {
        return this.peopleService.deletePeopleById(id);
    }

    /**
     * 根据Id查询人们信息
     * @param id 人们Id
     * @return 返回人们信息
     */
    public People getPeopleById(Integer id) {
        return this.peopleService.getPeopleById(id);
    }

    /**
     * 查询所有人们信息
     * @return 返回人们信息
     */
    public List<People> getPeopleAll() {
        return this.peopleService.getPeopleAll();
    }

}
